#include<iostream>
#include<unistd.h>
#include<pthread.h>
#include<ctime>
#include"pthpol.hpp"
bool handler(int data)
{
    srand(time(NULL));
    int n = rand() % 5;
    printf("Thread: %p Run Tast: %d--sleep %d sec\n", pthread_self(), data, n);
    sleep(n);
    return true;
}
int main()
{
    int i;
    ThreadPool pool;
    pool.initPool();
    for (i = 0; i < 10; i++) {
        ThreadTask *tt = new ThreadTask(i, handler);
        pool.PushTask(tt);
    }
    pool.Poolquit();
    return 0;
}